<template>
  <div id="app">
    <div class="container">
      <div class="carouse" v-for="(item,index) in pic" :key="index" id="carouse">
        <img class="pic" :src="item" alt>
      </div>
    </div>
  </div>
</template>
<script>
const GRID_NUM = 8;
export default {
  name: "name",
  components: {},
  computed: {},
  mounted() {},
  data() {
    return {
      singleAngle: 360 / GRID_NUM,
      normalRound: 4,
      count: 0,
      pic: [
        require("./assets/1.jpg"),
        require("./assets/2.jpg"),
        require("./assets/3.jpg"),
        require("./assets/4.jpg"),
        require("./assets/5.jpg"),
        require("./assets/6.jpg"),
        require("./assets/7.jpg"),
        require("./assets/8.jpg"),
        require("./assets/4.jpg")
      ]
    };
  },
  methods: {
    start() {
      let { singleAngle, normalRound } = this;
      let count = this.getRandomInt(0, 7);
      let endAddAngle =
        normalRound * 360 + count * singleAngle + singleAngle / 2;
      this.$refs.point.style["transform"] = `rotate(${endAddAngle}deg)`;
      this.count = count;
      this.tip();
    },
    getRandomInt(min, max) {
      return Math.floor(Math.random() * (max - min + 1) + min);
    }
  }
};
</script>
<style lang="scss" >
$picNum: 9;
* {
  margin: 0;
  padding: 0;
}
#app{
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #333;
}
.container {
  width: 360px;
  height: 600px;
  position: relative;
  font-size: 32px;
  color: #ffffff;
  text-align: center;
  line-height: 500px;
  margin: 240px auto;
  perspective: 2000px;
}

.carouse {
  transform-style: preserve-3d;
  transform: rotateX(-40deg);
  animation: scroll 10s linear infinite;
  .pic {
    display: block;
    position: absolute;
    width: 300px;
    height: 500px;
    border: 2px solid black;
  }
  @for $i from 1 through $picNum {
    &:nth-child(#{$i}) .pic {
      transform: rotateY(40 * ($i) + deg) translateZ(-600px);
       z-index: ($picNum - $i)
    }
  }
    //   @keyframes scroll {
    //     0% {
    //         transform: rotateY(0) ;
    //     }

    //     100% {
    //         transform: rotateY(360deg) ;
    //     }

    // }
}
</style>
